package org.budo.support.http.client;

import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;

import javax.net.ssl.X509TrustManager;

/**
 * @author lmw
 */
public class AnyTrustManager implements X509TrustManager {
    private X509Certificate[] acceptedIssuers;

    public AnyTrustManager() {
        this.acceptedIssuers = new X509Certificate[0];
    }

    public AnyTrustManager(X509Certificate[] acceptedIssuers) {
        this.acceptedIssuers = acceptedIssuers;
    }

    @Override
    public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException {
    }

    @Override
    public void checkServerTrusted(X509Certificate[] chain, String authType) throws CertificateException {
    }

    @Override
    public X509Certificate[] getAcceptedIssuers() {
        return this.acceptedIssuers;
    }
}